package vip.specimen.system.datasource.validation.question;

import vip.specimen.system.common.enums.QuestionTypeEnum;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * *@Author: 余浪人
 * *@Date：2021/4/28 10:07
 * *@Email:yulangren520@Gmail.com
 * *@QQ:1368419640
 **/
public class QuestionTypeImp implements ConstraintValidator<QuestionType, String> {
    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        for (QuestionTypeEnum typeEnum : QuestionTypeEnum.values()) {
            if (typeEnum.name().equals(s)) return true;
        }
        return false;
    }
}
